package algorithm.leetcode;

public class NO122_买卖股票的最佳时机II {
    public static void main(String[] args) {

    }

    static class SolutionYong {
        public int maxProfit(int[] prices) {
            // 每天存储的就是每天的纯利润
            int size = prices.length;
            // 0出售  1前一天
            int dp = 0;
            for (int i = 0; i < size - 1; i++) {
                dp = Math.max(dp, dp + (prices[i + 1] - prices[i]));
            }
            return dp;
        }
    }

}
